package algorithm;

public class leetcode_0278 {
    public int firstBadVersion(int n) {
        return sort(1,n);
    }
    public int sort(int left,int right){
        if(left==right) return left;
        int mid=left+(right-left)/2;
        if(isBadVersion(mid)){
            return sort(left,mid);
        }
        else{
            return  sort(mid+1,right);
        }
    }

    private boolean isBadVersion(int n) {
        return true;//仅用于排除报错
    }
}
//boolean isBadVersion(int version);